<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
		*{
			margin-top: 20px;
		}
			.demo1{
				height: 50px;
				background-color: skyblue;
			}
		</style>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="root">
			<!-- 阻止默认事件 -->
			<h2>我叫{{name}}</h2>
			<a href="http://www.baidu.com" @click.prevent="showInfo">邹宜臻</a>
			<!-- 阻止事件冒泡 -->
			<div @click="showInfo()" class="demo1">
				<button @click.stop="showInfo()">点我提示信息</button>
			</div>
			<!-- 事件只触发一次 -->
			<button @click.once="showInfo()">点我提示信息</button>
		</div>
		<script type="text/javascript">
			const vm=new Vue({
				el:'#root',
				data:{
					name:'邹宜臻'
				},
				methods:{
					showInfo(){
						alert('邹宜臻')
					}
				}
			})
		</script>
	</body>
</html>
